#include "rectEdge.hpp"
#include "rectMesh.hpp"
#include "rectMeshFunctions.hpp"
#include "util.hpp"

namespace hms {

RectEdge::RectEdge( const RectMesh& mesh, Index index ) :
	StructEdgeBase( mesh, index )
{}

auto RectEdge::lengthImp() const -> scalar {
	return m_mesh.edges().lengths()(m_index, 0);
}

auto RectEdge::normalImp() const -> NormalVector {
	return rectEdgeNormal(m_range);
}

auto RectEdge::midpointImp() const -> Vector2s {
	return 0.5 * (
		  m_mesh.vertex( vertices()[0] )
		+ m_mesh.vertex( vertices()[1] )
	);
}

auto RectEdge::intersectionImp() const -> Vector2s {
	return midpoint();
}


}